#ifndef GAMEENGINE_GRAPHICS_MESHES_SURFACE_MESH_H
#define GAMEENGINE_GRAPHICS_MESHES_SURFACE_MESH_H

#include <GameEngine/Graphics/graphics_settings.h>


#ifdef GAMEENGINE_NAMESPACES
namespace GameEngine {
#endif

template <class T> class Line3d;


//! Generic class for the storage of a surface mesh
/*!
 *  This is a base class for storing surface meshes.
 */
class _Graphics_decl SurfaceMesh {

public:
	//! Typedef used to handle vertex indexes
	typedef int VertexIndex;
	//! Typedef used to handle normal indexes
	typedef int NormalIndex;
	//! Typedef used to handle texture coordinate indexes
	typedef int TextureCoordinateIndex;

	//! Typedef used to handle vertex counts
	typedef unsigned int VertexCount;
	//! Typedef used to handle normal counts
	typedef unsigned int NormalCount;
	//! Typedef used to handle texture coordinate counts
	typedef unsigned int TextureCoordinateCount;
	//! Typedef used to handle face counts
	typedef unsigned int FaceCount;

	SurfaceMesh();
	SurfaceMesh(const SurfaceMesh& rhs);
	SurfaceMesh& operator=(const SurfaceMesh& rhs);
	virtual ~SurfaceMesh();

	//! Accessor to the number of vertices in the mesh
	/*!
	 @return The number of vertices in the mesh
	 @note The implementation of this function is deferred to derived classes
	 */
	virtual VertexCount vertex_count() const = 0;
	//! Accessor to the number of normals in the mesh
	/*!
	 @return The number of normals in the mesh
	 @note The implementation of this function is deferred to derived classes
	 */
	virtual NormalCount normal_count() const = 0;
	//! Accessor to the number of texture coordinates in the mesh
	/*!
	 @return The number of texture coordinates in the mesh
	 @note The implementation of this function is deferred to derived classes
	 */
	virtual TextureCoordinateCount texture_coordinate_count() const = 0;
	//! Accessor to the number of faces in the mesh
	/*!
	 @return The number of faces in the mesh
	 @note The implementation of this function is deferred to derived classes
	 */
	virtual FaceCount face_count() const = 0;

	//! Draw the mesh
	/*!
	 @param ray The picking ray under the mouse
	 @param transparency Determines whether transparent or opaque graphic primitives should be drawn
	 @return True if the mesh could be rendered, false otherwise
	 @note The implementation of this function is deferred to derived classes
	 */
	virtual bool render_mesh(const Line3d<float>& ray, bool transparency) = 0;
};


#ifdef GAMEENGINE_NAMESPACES
} // namespace GameEngine
#endif

#endif
